import numpy as np

# 1.list 转numpy
x = [1,2,3]
y = [(1,2,3),(4,5,6)] 
a = np.asarray(x)
b = np.asarray(y)
print(a,b)
'''
[1 2 3]

[[1 2 3]
 [4 5 6]]
'''

# 2.迭代对象转numpy
z_list = range(5)
it = iter(z_list)
c = np.fromiter(it, dtype=int)
print(c)
'''[0 1 2 3 4]
'''